<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .outer{
        width: 200px;
        height: 200px;
        background-color: red;
    }
    .inner{
        width: 100px;
        height: 100px;
        background-color: yellow;
    }
</style>
<body>
    <div class="box">
        <a :href="url" @click.prevent="test">百度一下</a>
        <!-- 在事件后面添加修饰符.prevent  作用：阻止浏览器默认行为   原生 preventDefault（） -->
        <div class="outer" @click="outerTest">
            <div class="inner" @click.stop="innerTest"></div>
        </div>
        <!-- 在事件名后面加修饰符.stop  作用：阻止事件冒泡  原生stopPropagation()  -->

    </div>
    <script src="../js/vue.js"></script>
    <script>
        let vm1 = new Vue({
            el:'.box',
            data:{
                url:'http://baidu.com'
            },
            methods: {
                test(){
                    console.log('test');
                },
                innerTest(){
                    console.log('innertest');
                },
                outerTest(){
                    console.log('outerTest');
                }

            },
        })
    </script>
</body>
</html>